/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * infDoctorAmbulatorio.java
 *
 * Created on 25/11/2010, 12:03:16 AM
 */

package GUI.ambulatorio;

import GUI.ambulatorio.datosAcademicosAmbulatorio;
import GUI.ambulatorio.ambulatorio;
import javax.swing.JOptionPane;
import cprincipal.*;
import Persistencia.*;
import venehealthfinal.Validar;

/**
 *
 * @author marcelo
 */
public class infDoctorAmbulatorio extends javax.swing.JFrame {

    /** Creates new form infDoctorAmbulatorio */
    private boolean resultado = false;
    DoctorXml datosDoct=new DoctorXml();
    
    public infDoctorAmbulatorio() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        LabelNombre = new javax.swing.JLabel();
        LabelApellido = new javax.swing.JLabel();
        LabelCedula = new javax.swing.JLabel();
        LabelLocalidad = new javax.swing.JLabel();
        LabelAniosExperiencia = new javax.swing.JLabel();
        LabelAnioNac = new javax.swing.JLabel();
        TxtNombre = new javax.swing.JTextField();
        TxtApellido = new javax.swing.JTextField();
        TxtCedula = new javax.swing.JTextField();
        LabelNumeroColegiatura = new javax.swing.JLabel();
        TxtNumeroColegiatura = new javax.swing.JTextField();
        LabelUniversidadEgreso = new javax.swing.JLabel();
        TxtUniversidadEgreso = new javax.swing.JTextField();
        LabelEstudiosEspeciales = new javax.swing.JLabel();
        TxtEstudiosEspeciales = new javax.swing.JTextField();
        LabelEspecialidad = new javax.swing.JLabel();
        TxtEspecialidad = new javax.swing.JTextField();
        LabelHoraEntrada = new javax.swing.JLabel();
        LabelHoraSalida = new javax.swing.JLabel();
        TxtAniosExperiencia = new javax.swing.JTextField();
        TxtAnioNac = new javax.swing.JTextField();
        LabelTelefono = new javax.swing.JLabel();
        TxtTelefono = new javax.swing.JTextField();
        LabelDireccion = new javax.swing.JLabel();
        TxtDireccion = new javax.swing.JTextField();
        ComboBoxLocalidad = new javax.swing.JComboBox();
        LabelDisponible = new javax.swing.JLabel();
        ComboBoxDisponible = new javax.swing.JComboBox();
        ComboBoxHoraEntrada = new javax.swing.JComboBox();
        ComboBoxHoraSalida = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        jComboBox1 = new javax.swing.JComboBox();
        jPanel2 = new javax.swing.JPanel();
        BotonEliminar = new javax.swing.JButton();
        BotonAgregar = new javax.swing.JButton();
        BotonRegresar = new javax.swing.JButton();
        BotonModificar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel1.setForeground(new java.awt.Color(204, 0, 0));
        jLabel1.setText("Informacion de Doctor");

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Personales"));
        jPanel1.setEnabled(false);

        LabelNombre.setText("Nombre:");

        LabelApellido.setText("Apellido:");

        LabelCedula.setText("Cedula:");

        LabelLocalidad.setText("Localidad:");

        LabelAniosExperiencia.setText("Años de Experiencia:");

        LabelAnioNac.setText("Año de Nacimiento:");

        TxtNombre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TxtNombreActionPerformed(evt);
            }
        });

        LabelNumeroColegiatura.setText("Num. de Colegiatura:");

        LabelUniversidadEgreso.setText("Universidad de Egreso:");

        TxtUniversidadEgreso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TxtUniversidadEgresoActionPerformed(evt);
            }
        });

        LabelEstudiosEspeciales.setText("Estudios Especiales:");

        LabelEspecialidad.setText("Especialidad:");

        LabelHoraEntrada.setText("Hora Entrada");

        LabelHoraSalida.setText("Hora Salida");

        TxtAniosExperiencia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TxtAniosExperienciaActionPerformed(evt);
            }
        });

        LabelTelefono.setText("Telefono:");

        LabelDireccion.setText("Direccion:");

        ComboBoxLocalidad.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Zulia", "Tachira", "Merida", "Trujillo", "Apure", "Barinas", "Portuguesa", "Lara", "Falcon", "Yaracuy", "Cojedes", "Carabobo", "Dto. Capital", "Vargas", "Miranda", "Guarico", "Anzoategui", "Bolivar ", "Amazonas", "Monagas", "Delta Amacuro", "Sucre" }));

        LabelDisponible.setText("Disponibilidad:");

        ComboBoxDisponible.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Si", "No" }));

        ComboBoxHoraEntrada.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-", "7:00 am", "8:00 am", "9:00 am", "10:00 am", "11:00 am", "12:00 pm", "1:00 pm", "2:00 pm", "3:00 pm", "4:00 pm", "5:00 pm", "6:00 pm ", "7:00 pm", "8:00 pm", "9:00 pm ", "10:00 pm", "11:00 pm", "12:00 am", "1:00 am", "2:00 am", "3:00 am", "4:00 am", "5:00 am", "6:00 am" }));

        ComboBoxHoraSalida.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-", "7:00 am", "8:00 am", "9:00 am", "10:00 am", "11:00 am", "12:00 pm", "1:00 pm", "2:00 pm", "3:00 pm", "4:00 pm", "5:00 pm", "6:00 pm ", "7:00 pm", "8:00 pm", "9:00 pm ", "10:00 pm", "11:00 pm", "12:00 am", "1:00 am", "2:00 am", "3:00 am", "4:00 am", "5:00 am", "6:00 am" }));

        jLabel2.setText("Infraestructura:");

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "-", "Clinica Los Naranjos", "Ambulatorio El Hatillo", "Ambulatorio Los Pomelos", "Clinica El Trigal", "Ambulatorio Maria Jose", "Ambulatorio San Antonio" }));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(LabelAnioNac)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(TxtAnioNac, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(LabelLocalidad)
                        .addGap(18, 18, 18)
                        .addComponent(ComboBoxLocalidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addComponent(LabelNumeroColegiatura)
                                    .addGap(18, 18, 18)
                                    .addComponent(TxtNumeroColegiatura, javax.swing.GroupLayout.DEFAULT_SIZE, 556, Short.MAX_VALUE))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(LabelUniversidadEgreso)
                                        .addComponent(LabelEstudiosEspeciales)
                                        .addComponent(LabelEspecialidad)
                                        .addComponent(LabelAniosExperiencia))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(TxtEspecialidad, javax.swing.GroupLayout.DEFAULT_SIZE, 554, Short.MAX_VALUE)
                                        .addComponent(TxtUniversidadEgreso, javax.swing.GroupLayout.DEFAULT_SIZE, 554, Short.MAX_VALUE)
                                        .addComponent(TxtEstudiosEspeciales, javax.swing.GroupLayout.DEFAULT_SIZE, 554, Short.MAX_VALUE)
                                        .addGroup(jPanel1Layout.createSequentialGroup()
                                            .addComponent(TxtAniosExperiencia, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(121, 121, 121)
                                            .addComponent(jLabel2)
                                            .addGap(18, 18, 18)
                                            .addComponent(jComboBox1, 0, 256, Short.MAX_VALUE)))))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                .addComponent(LabelTelefono)
                                .addGap(18, 18, 18)
                                .addComponent(TxtTelefono, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                    .addComponent(LabelDireccion)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(TxtDireccion))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                    .addComponent(LabelNombre)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(TxtNombre))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(LabelApellido)
                                        .addComponent(LabelCedula))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(TxtApellido, javax.swing.GroupLayout.PREFERRED_SIZE, 641, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGroup(jPanel1Layout.createSequentialGroup()
                                            .addComponent(TxtCedula, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(156, 156, 156)
                                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                                    .addComponent(LabelDisponible)
                                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                    .addComponent(ComboBoxDisponible, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                                        .addComponent(LabelHoraSalida)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                        .addComponent(ComboBoxHoraSalida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                                        .addComponent(LabelHoraEntrada)
                                                        .addGap(18, 18, 18)
                                                        .addComponent(ComboBoxHoraEntrada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))))))
                        .addGap(324, 324, 324)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(LabelNombre)
                    .addComponent(TxtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(LabelApellido)
                    .addComponent(TxtApellido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(TxtCedula, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(LabelCedula, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(LabelHoraEntrada)
                        .addComponent(ComboBoxHoraEntrada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(LabelAnioNac)
                            .addComponent(TxtAnioNac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(LabelLocalidad)
                            .addComponent(ComboBoxLocalidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(LabelNumeroColegiatura)
                            .addComponent(TxtNumeroColegiatura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(LabelHoraSalida)
                            .addComponent(ComboBoxHoraSalida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(LabelDisponible)
                            .addComponent(ComboBoxDisponible, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(LabelUniversidadEgreso)
                    .addComponent(TxtUniversidadEgreso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(LabelEstudiosEspeciales)
                    .addComponent(TxtEstudiosEspeciales, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(LabelEspecialidad)
                    .addComponent(TxtEspecialidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(LabelAniosExperiencia)
                    .addComponent(TxtAniosExperiencia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2)
                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(LabelTelefono)
                    .addComponent(TxtTelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(LabelDireccion)
                    .addComponent(TxtDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(204, 204, 204))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Opciones"));

        BotonEliminar.setText("Eliminar");
        BotonEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonEliminarActionPerformed(evt);
            }
        });

        BotonAgregar.setText("Agregar");
        BotonAgregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonAgregarActionPerformed(evt);
            }
        });

        BotonRegresar.setText("Regresar");
        BotonRegresar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonRegresarActionPerformed(evt);
            }
        });

        BotonModificar.setText("Modificar");
        BotonModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonModificarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(BotonEliminar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(BotonAgregar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(BotonRegresar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(BotonModificar, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(BotonEliminar)
                .addComponent(BotonAgregar)
                .addComponent(BotonRegresar)
                .addComponent(BotonModificar))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel1)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(230, 230, 230)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 561, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void clearScreen(){

    TxtAnioNac.setText("");
    TxtAniosExperiencia.setText("");
    TxtApellido.setText("");
    TxtEspecialidad.setText("");
    TxtEstudiosEspeciales.setText("");
    TxtNombre.setText("");
    TxtNumeroColegiatura.setText("");
    TxtUniversidadEgreso.setText("");
    TxtTelefono.setText("");
    TxtDireccion.setText("");
    

    }


    private void BotonModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonModificarActionPerformed
        // TODO add your handling code here:

        if (TxtCedula.getText().isEmpty()) {
            JOptionPane.showMessageDialog(null, "Por favor indique la cédula", "Error falta cédula", JOptionPane.ERROR_MESSAGE);
        } else {
            int valor = Validar.ValidarEntero(TxtCedula.getText(), "Cédula no es numérica");
            if (valor == 1) {
                Doctor doct = datosDoct.buscarDoctor(Integer.parseInt(TxtCedula.getText()));
                if (doct == null) {
                    JOptionPane.showMessageDialog(null, "Doctor no Existe", "Error cédula no encontrada", JOptionPane.ERROR_MESSAGE);
                } else {
                    TxtCedula.setEnabled(false);
                    /*if (TxtNombre.getText().isEmpty() || TxtApellido.getText().isEmpty() || TxtAnioNac.getText().isEmpty() || TxtLocalidad.getText().isEmpty() ||
                        TxtNumeroColegiatura.getText().isEmpty() || TxtUniversidadEgreso.getText().isEmpty() || TxtEstudiosEspeciales.getText().isEmpty() ||
                        TxtEspecialidad.getText().isEmpty() || TxtAniosExperiencia.getText().isEmpty() || TxtDisponibilidad.getText().isEmpty() || 
                        TxtHoraEntrada.getText().isEmpty()|| TxtHoraSalida.getText().isEmpty() ) {

                                JOptionPane.showMessageDialog(null, "Por favor indique los datos completos", "Error faltan Datos", JOptionPane.ERROR_MESSAGE);
                    } else {
                        int valor2 = Validar.ValidarEntero(TxtAniosExperiencia.getText(),"Eficiencia no posee el formato apropiado");
            if (valor2 == 1) {*/
                doct.setNombre(TxtNombre.getText());
                doct.setApellido(TxtApellido.getText());
                doct.setAnionac(TxtAnioNac.getText());
                doct.setLocalidad(ComboBoxLocalidad.getName());
                doct.setNumerocolegitura(TxtNumeroColegiatura.getText());
                doct.setUniversidadegreso(TxtUniversidadEgreso.getText());
                doct.setEstudioespeciales(TxtEstudiosEspeciales.getText());
                doct.setEspecialidad(TxtEspecialidad.getText());
                doct.setAnioexperiencia(Integer.parseInt(TxtAniosExperiencia.getText()));
                doct.setDisponible(ComboBoxDisponible.getName());
                doct.setHoraentrada(ComboBoxHoraEntrada.getName());
                doct.setHorasalida(ComboBoxHoraSalida.getName());
                doct.setTelefono(TxtTelefono.getText());
                doct.setDireccion(TxtDireccion.getText());
                datosDoct.actualizarDoctor(doct);
                JOptionPane.showMessageDialog(null, "Doctor " + TxtNombre.getText() + " " + TxtApellido.getText(), " modificado con exito!", JOptionPane.INFORMATION_MESSAGE);
                clearScreen();
                TxtCedula.setText("");
                }
        
                
            }
        }    
}//GEN-LAST:event_BotonModificarActionPerformed

    private void BotonRegresarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonRegresarActionPerformed
        // TODO add your handling code here:
        ambulatorio ventana=new ambulatorio();
        ventana.setVisible(true);
        this.dispose();
}//GEN-LAST:event_BotonRegresarActionPerformed

    private void TxtAniosExperienciaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TxtAniosExperienciaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_TxtAniosExperienciaActionPerformed

    private void BotonAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonAgregarActionPerformed
        // TODO add your handling code here:
        //if (TxtCedula.getText().isEmpty() || TxtNombre.getText().isEmpty() || TxtApellido.getText().isEmpty() || TxtAnioNac.getText().isEmpty() || TxtLocalidad.getText().isEmpty() || TxtNumeroColegiatura.getText().isEmpty() || TxtUniversidadEgreso.getText().isEmpty() || TxtEstudiosEspeciales.getText().isEmpty() || TxtEspecialidad.getText().isEmpty() || TxtDisponibilidad.getText().isEmpty() || TxtHoraEntrada.getText().isEmpty() || TxtHoraSalida.getText().isEmpty()) {
        //    JOptionPane.showMessageDialog(null, "Por favor llene todos los campos", "Error al Registrar", JOptionPane.ERROR_MESSAGE);
        //} else {
        //    int valor = Validar.ValidarEntero(TxtAniosExperiencia.getText(), "Años de experiencia no tiene formato adecuado,introduzca numero entero");
        //}
        String localidad =(String) ComboBoxLocalidad.getSelectedItem();
        String disponibilidad = (String) ComboBoxDisponible.getSelectedItem();
        String infraestructura = (String) "";
        String horaentrada = (String) ComboBoxHoraEntrada.getSelectedItem();
        String horasalida = (String) ComboBoxHoraSalida.getSelectedItem();
        Doctor doct = new Doctor( TxtNombre.getText(), TxtApellido.getText(), Integer.parseInt(TxtCedula.getText()) , TxtAnioNac.getText(), localidad, TxtTelefono.getText(), TxtDireccion.getText(), TxtNumeroColegiatura.getText(), TxtUniversidadEgreso.getText(), TxtEstudiosEspeciales.getText(), TxtEspecialidad.getText(), Integer.parseInt(TxtAniosExperiencia.getText()), disponibilidad, horasalida, horaentrada, infraestructura);
                    resultado = datosDoct.agregarDoctor(doct);
                    if (resultado == true) {
                        JOptionPane.showMessageDialog(null, "Doctor " + TxtNombre.getText() + " " + TxtApellido.getText(), " agregado con exito!", JOptionPane.INFORMATION_MESSAGE);
                        clearScreen();
                        TxtCedula.setText("");
                    } else {
                        if (doct != null) {
                            JOptionPane.showMessageDialog(null, "Operacion Fallida", "Error", JOptionPane.ERROR_MESSAGE);
                        }
                    }
        
    }//GEN-LAST:event_BotonAgregarActionPerformed

    private void BotonEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonEliminarActionPerformed
        // TODO add your handling code here:
       // String localidad = (String) ComboBoxLocalidad.getSelectedItem();
        //String disponibilidad = (String) ComboBoxDisponible.getSelectedItem();

        if (TxtCedula.getText().isEmpty()){ /*&& (!TxtNombre.getText().isEmpty()) && (!TxtApellido.getText().isEmpty()) && (!TxtAnioNac.getText().isEmpty()) && (!TxtLocalidad.getText().isEmpty()) && (!TxtNumeroColegiatura.getText().isEmpty()) && (!TxtUniversidadEgreso.getText().isEmpty()) && (!TxtEstudiosEspeciales.getText().isEmpty()) && (!TxtEspecialidad.getText().isEmpty()) && (!TxtDisponibilidad.getText().isEmpty()) && (!TxtHoraEntrada.getText().isEmpty()) && (!TxtHoraSalida.getText().isEmpty())*/
            JOptionPane.showMessageDialog(null, "Error, campo invalidos", "Debe indicar un numero de cedula valido", JOptionPane.ERROR_MESSAGE);
        } else {
            int valor = Validar.ValidarEntero(TxtCedula.getText(), "Cédula no es numérica");
            if (valor == 1) {
               Doctor doct = datosDoct.buscarDoctor(Integer.parseInt(TxtCedula.getText()));
                if (doct == null) {
                  JOptionPane.showMessageDialog(null, "Doctor no Existe", "Error cédula no encontrada", JOptionPane.ERROR_MESSAGE);
                } else {

                    TxtNombre.setText(doct.getNombre());
                    TxtApellido.setText(doct.getApellido());
                    TxtCedula.setText(String.valueOf(doct.getCedula()));
                    TxtAnioNac.setText(doct.getAnionac());
                    ComboBoxLocalidad.setVisible(false);
                    LabelLocalidad.setVisible(false);
                    TxtNumeroColegiatura.setText(doct.getNumerocolegitura());
                    TxtUniversidadEgreso.setText(doct.getUniversidadegreso());
                    TxtEstudiosEspeciales.setText(doct.getEstudioespeciales());
                    TxtEspecialidad.setText(doct.getEspecialidad());
                    TxtAniosExperiencia.setText(String.valueOf(doct.getAnioexperiencia()));
                    ComboBoxDisponible.setVisible(false);
                    LabelDisponible.setVisible(false);
                    TxtTelefono.setText(doct.getTelefono());
                    TxtDireccion.setText(doct.getDireccion());
                    int conf= JOptionPane.showOptionDialog(
                            null, "¿Desea Realizar La Operación?", "::::...Confirmación...:::",
                            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
                    if (conf == 0) {
                        datosDoct.borrarDoctor(Integer.parseInt(TxtCedula.getText()));
                        clearScreen();
                        TxtCedula.setText("");
                        //TxtCedula.setText("");
                    }
                }
        }
        }
    }//GEN-LAST:event_BotonEliminarActionPerformed

    private void TxtNombreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TxtNombreActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_TxtNombreActionPerformed

    private void TxtUniversidadEgresoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TxtUniversidadEgresoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_TxtUniversidadEgresoActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new infDoctorAmbulatorio().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BotonAgregar;
    private javax.swing.JButton BotonEliminar;
    private javax.swing.JButton BotonModificar;
    private javax.swing.JButton BotonRegresar;
    private javax.swing.JComboBox ComboBoxDisponible;
    private javax.swing.JComboBox ComboBoxHoraEntrada;
    private javax.swing.JComboBox ComboBoxHoraSalida;
    private javax.swing.JComboBox ComboBoxLocalidad;
    private javax.swing.JLabel LabelAnioNac;
    private javax.swing.JLabel LabelAniosExperiencia;
    private javax.swing.JLabel LabelApellido;
    private javax.swing.JLabel LabelCedula;
    private javax.swing.JLabel LabelDireccion;
    private javax.swing.JLabel LabelDisponible;
    private javax.swing.JLabel LabelEspecialidad;
    private javax.swing.JLabel LabelEstudiosEspeciales;
    private javax.swing.JLabel LabelHoraEntrada;
    private javax.swing.JLabel LabelHoraSalida;
    private javax.swing.JLabel LabelLocalidad;
    private javax.swing.JLabel LabelNombre;
    private javax.swing.JLabel LabelNumeroColegiatura;
    private javax.swing.JLabel LabelTelefono;
    private javax.swing.JLabel LabelUniversidadEgreso;
    private javax.swing.JTextField TxtAnioNac;
    private javax.swing.JTextField TxtAniosExperiencia;
    private javax.swing.JTextField TxtApellido;
    private javax.swing.JTextField TxtCedula;
    private javax.swing.JTextField TxtDireccion;
    private javax.swing.JTextField TxtEspecialidad;
    private javax.swing.JTextField TxtEstudiosEspeciales;
    private javax.swing.JTextField TxtNombre;
    private javax.swing.JTextField TxtNumeroColegiatura;
    private javax.swing.JTextField TxtTelefono;
    private javax.swing.JTextField TxtUniversidadEgreso;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    // End of variables declaration//GEN-END:variables

}
